﻿using EntityModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class PeopleController : ControllerBase
    {
        private readonly ApiDbContext db;
        public PeopleController(ApiDbContext context)
        {
            db = context;
        }

        /// <summary>
        /// 查询所有人员
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<People> GetAll()
        {
            return db.People.ToList();
        }

        /// <summary>
        /// 查询所有有标签的孤寡人员列表接口
        /// </summary>
        /// <param name="lable_empty"></param>
        /// <returns></returns>
        [HttpGet]
        public Result Get()
        {
            Result result = new Result();
            result.Data= db.People.Select(s=>s.Lable_empty).SingleOrDefault();
            return result;
           
        }
    }
}
